home *** CD-ROM | disk | FTP | other *** search
/ Aminet 25 / Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso / Aminet / util / cdity / Stroke.lha / Stroke / Stroke.doc < prev    next >
Encoding:
Text File  |  1998-04-15  |  14.2 KB  |  415 lines

  1. Stroke Commodity 1.1 (15.4.98)
  2.                     Pasi 'Albert' Ojala
  3.                     albert@cs.tut.fi
  4.                     http://www.cs.tut.fi/~albert/
  5.  
  6.  
  7. What is Stroke Commodity?
  8. ~~~~~~~~~~~~~~~~~~~~~~~~~
  9. Stroke commodity is a mouse-controlled Intuition event generator.
  10. That's a short explanation.  A longer version explains that you
  11. can draw different symbols using the mouse and the commodity will
  12. then interpret them and insert the appropriate events into the
  13. input stream.
  14.  
  15. Strokes are most useful with a 3-button mouse.  You assign the middle
  16. button to be the stroke 'key'.  Press the button down, draw a symbol,
  17. and release the button.  Stroke commodity will then check what you
  18. wanted, creates the corresponding input events and inserts them into
  19. the input event chain.
  20.  
  21.  
  22. Installation
  23. ~~~~~~~~~~~~
  24. Use the accompanied installation script. It installs all files needed
  25. into a directory, and optionally installs a launcher icon into the
  26. WBStartup drawer. Default 4-color icons and MagicWB icons are available.
  27. Start the commodity by double-clicking either the startup-icon or
  28. the installed version. You can then press the default popkey
  29. combination control + left alt + s to open the commodity's window
  30. so that you can configure it to your liking.
  31.  
  32.  
  33. Fixes for version 1.0
  34. ~~~~~~~~~~~~~~~~~~~~~
  35. Fixed an enforcer hit which occurred when menu button was used
  36. in the Stroke window and no menu selection was picked.
  37.  
  38.  
  39. Fixes for version 1.1
  40. ~~~~~~~~~~~~~~~~~~~~~
  41. It is now possible to prevent the swallowing of stroke events.
  42. Before only left and right button presses were passed through
  43. if the stroke did not use any qualifier keys.
  44.  
  45.  
  46. Theory of Operation
  47. ~~~~~~~~~~~~~~~~~~~
  48. When you press the stroke button with the right qualifier key(s)
  49. pressed, the commodity starts to record mouse movements. When you
  50. release the button, a series of operations is performed on the
  51. recorded movements.
  52.  
  53. These movements are relative, i.e. they represent the relative
  54. movement of the mouse. This movement is first filtered with a
  55. median filter to get rid of some noise. Then the movement is
  56. changed from relative to absolute coordinates. Minimum and maximum
  57. values in both directions (horizontal and vertical) are determined.
  58.  
  59. These values represent the rectangular region which contain the
  60. stroke. The stroke is scaled into a 3-by-3 matrix. However, if
  61. the rectangle is more than two times as wide/high as high/wide,
  62. the original aspect ratio is preserved. This makes it possible to
  63. have single horizontal and vertical strokes.
  64.  
  65. If the absolute movement in horizontal or vertical direction is
  66. very small, that movement is discarded. The stroke then has no
  67. movement.
  68.  
  69. When the stroke has been scaled, it is converted back to relative
  70. coordinates for detection. Direction-length -representation is
  71. the logical format, even if it is a bit differently handled in
  72. the program. Anyway, detection is tried next. The new stroke is
  73. compared to existing strokes. Generally it is necessary that
  74. the strokes have the same lines (the same direction and length)
  75. in the same order. The first line and the last line in the stroke
  76. are exceptions, they only need to have the same direction.
  77.  
  78. If a match is found, the corresponding action is performed
  79. (unless "watch only" is selected). If there is no match, and
  80. "learn mode" is activated, the new stroke is added and gets the
  81. currently selected action as a default action. This action can
  82. be later changed or the stroke can be deleted. The stroke is
  83. also shown in the commodity's window. If the window isn't open,
  84. it's opened and the screen is brought to front. If there was no
  85. match and "learn mode" was not activated, nothing happens.
  86.  
  87.  
  88.  
  89.  
  90.  
  91. The Edit Window:
  92. ~~~~~~~~~~~~~~~~
  93. Qualifier Selection:
  94. --------------------
  95. Qualifier
  96. Button
  97.     Here you can select the button and the qualifiers you
  98.     need when making strokes. Middle button is the default.
  99.     When you select qualifier keys and change the button,
  100.     the change will only take place if you use "Apply",
  101.     "Save", or "Use". This also applies to the "Relaxed"
  102.     selection, but does not apply to the stroke and action
  103.     editing and commands.
  104. Swallow
  105.     Determines if the commodity should eat up all events
  106.     that are meant for it, i.e. the stroke mouse button is
  107.     pressed with the right qualifiers. Left and right mouse
  108.     button events (when there are no qualifier keys) can not
  109.     be swallowed (this gadget will be ghosted, i.e. inactive
  110.     then).
  111. Exact Match
  112.     Selects exact/relaxed qualifiers. In either mode you
  113.     need to press the selected qualifiers, in relaxed mode
  114.     you can also press additional qualifiers. In exact match
  115.     mode you can only press the selected qualifiers.
  116. Apply
  117.     This gadget updates the current qualifiers, stroke button,
  118.     swallow and "relaxed" setting. Is equal to "Use", except
  119.     that it does not close the window. This is not really "Test",
  120.     like in many other preference and commodity programs, because
  121.     "Cancel" does not restore old settings.
  122.  
  123.  
  124. Stroke Controls:
  125. ----------------
  126. Watch Only
  127.     If this box is checked, strokes will not cause any
  128.     input events to be generated. This is useful when you
  129.     are initially teaching a lot of commands and don't want
  130.     them to be 'executed'.
  131. Learn Mode
  132.     When this box is checked, strokes that are not recognized
  133.     are automatically added. The preferred sequence in teaching
  134.     new commands is to first select/set the required action
  135.     (input event description) and then draw the stroke. A new
  136.     stroke is always associated with the action currently selected.
  137.     A new action can be set using the "Bind" gadget.
  138. Stroke <>
  139.     These two small gadgets are used to step through the
  140.     existing strokes. The action display is updated to show
  141.     the action associated with the current showing stroke.
  142. Delete
  143.     This button deletes the current stroke.
  144.  
  145.  
  146. Action Controls:
  147. ----------------
  148. Action <>
  149.     These gadgets are used to select the right action for
  150.     a stroke.
  151. Action String
  152.     Write the action you want here. The action will be updated
  153.     when you press return, so don't forget to press it. This
  154.     changes the action for all strokes that has that action
  155.     "bound" to them.
  156. Bind
  157.     This gadget associates the current action with the
  158.     current stroke. If the current stroke has already
  159.     the current action, this gadget is ghosted.
  160.  
  161.  
  162. Qualifier/Window Controls:
  163. --------------------------
  164. Save
  165.     The selected stroke qualifiers and button will become
  166.     active. Also saves preferences to the icon file, saves
  167.     strokes if they have been changed and closes the window.
  168. Use
  169.     The selected stroke qualifiers and button will become
  170.     active. Also closes the window.
  171. Cancel
  172.     Closes the window without changing the stroke qualifiers
  173.     or the button.
  174.  
  175.  
  176. Menus:
  177. ~~~~~~
  178. Project:
  179. --------
  180. Save Strokes
  181.     Saves current strokes and their actions whether they have
  182.     been changed or not.
  183. Save Prefs
  184.     Saves current preferences whether they have been changed or not.
  185. About
  186.     Opens/closes an about-requester. This is an asynchronous window,
  187.     so you can use strokes while the requester is open.
  188. Hide
  189.     Closes the window but keeps the commodity resident.
  190. Quit
  191.     Quits the commodity. If you try to quit when there are unsaved
  192.     strokes/actions, you are asked if you want to save them.
  193.  
  194.  
  195. Edit
  196. ~~~~
  197. Reset to Defaults
  198.     Initializes the preferences to the default values.
  199. Last Saved
  200.     Reads in the lastly-saved preferences and strokes/actions.
  201. Clear All
  202.     Clears all actions and removes all strokes.
  203.  
  204.  
  205.  
  206.  
  207. Teaching Strokes
  208. ~~~~~~~~~~~~~~~~
  209. Teaching new strokes and actions is best described using an example.
  210. You want to teach a stroke that changes screens.  You have decided
  211. that an up-arrow would be the right stroke.
  212.  
  213. 1)    Start the commodity so that it opens its window.
  214.     (If you have CX_POPUP=NO in the icon, run the program
  215.      again and it will open its window, or use commodity
  216.      exchange to ask the commodity to open its window.)
  217.     You can also open the window by pressing the popkey,
  218.     by default control-left alt-s (<ctrl lalt s>).
  219.  
  220. 2)    Check boxes "Learn Mode" and "Watch Only"
  221.  
  222. 3)    Select a free action, activate the string gadget and
  223.     write "<lcommand m>", not including the quotes.
  224.     (lcommand means the left amiga key, and left amiga+m
  225.      is the screen shuffle combination.)
  226.  
  227. 4)    Remember to press return so that the action is really
  228.     updated.
  229.  
  230. 5)    Press down the required qualifier keys and the stroke
  231.     button (by default no qualifiers, just the middle button)
  232.  
  233. 6)    Move the mouse directly upwards, a moderate amount.
  234.  
  235. 7)    Release the button and/or qualifiers
  236.  
  237. 8)    The stroke you just made should appear. If it didn't,
  238.     you used a wrong qualifier-button combination or didn't
  239.     have the "Learn Mode" active. The first line in the
  240.     stroke is drawn in different color than the rest so that
  241.     it would be easier to see where the stroke starts.
  242.  
  243. 9)    If the stroke doesn't correspond to an up-arrow you draw,
  244.     press "Delete", select the action that has "<lcommand m>"
  245.     and try again. If it did, you can deselect "Learn Mode"
  246.     and "Watch Only" and try out the action you just taught.
  247.  
  248.  
  249. Changing Actions
  250. ~~~~~~~~~~~~~~~~
  251. Many strokes can have the same action. If you want to change
  252. an action you have to options:
  253.  
  254. 1)    Change the action itself - all strokes that had that
  255.     action still has that action, it's just different now.
  256.     Just write a new action text into the string gadget and
  257.     press return.
  258.  
  259. 2)    Select a new action to a stroke - only the current stroke's
  260.     action will be changed. In this case use the "Bind" gadget
  261.     to set the new action to the stroke.
  262.  
  263.  
  264.  
  265. Small List of Events
  266. ~~~~~~~~~~~~~~~~~~~~
  267. smake\n            - "smake" followed by a return
  268. <rcommand q>        - right amiga + q, standard "quit" shortcut
  269. <ctrl lalt help>    - control + left alt + help, default exchange hotkey
  270. <ctrl x>        - control + x, shell delete-line command
  271. <f1>            - the first function key
  272. <rawmouse mouse_leftpress><rawmouse upstroke mouse_leftpress>
  273.             - simulates left mouse button press
  274.  
  275.  
  276. Features & Hints
  277. ~~~~~~~~~~~~~~~~
  278.  
  279. If you select (and "apply" or "use") left or right mouse button
  280. without any qualifiers, the commodity will not allow you to filter
  281. (i.e. swallow) those button events. This is because it would become
  282. somewhat difficult to change the settings or use menus. However, if
  283. you select middle mouse button or either of the other buttons with
  284. at least one qualifier, button events with those qualifiers can be
  285. filtered out with the "swallow" setting. Popkey events are also
  286. filtered, they are not seen by other commodities or applications.
  287.  
  288. There were occasional small reversing-effects coming from the mouse.
  289. A median filter was added to remove small mouse glitches.
  290.  
  291. Do not use complex strokes!  The more complex you make your strokes,
  292. the more of them you need to teach to get all the possible combinations
  293. of mouse movements.  With single straight lines you already have eight
  294. strokes, with two straight lines you have 32 more.  These usually need
  295. only one stroke to be recognized correctly, something like O needs 2-4
  296. different strokes.  (O or 0 is a stroke that is actually quite usable.)
  297.  
  298. On the other hand, using only two-line strokes will present a problem
  299. in remembering which stroke does what. Try to pick intuitive strokes.
  300. For example, I assigned amiga-Q to a "bottom-right to top-left" stroke.
  301. A logical extension to this was a stroke "bottom-right, top-left,
  302. bottom-left" bind to amiga-H. Simple up-stroke was intuitive for
  303. screen changing (left amiga M).
  304.  
  305. Preferences are saved into tooltype entries in the icon file. If
  306. there is no icon file when you save preferences, a default tool icon
  307. is created and the settings are saved there. You can change the settings
  308. using e.g. workbench "info" command and then load them using "Last Saved"
  309. in the commodity's edit menu.
  310.  
  311. The strokes and actions are saved into a separate file. By default
  312. the file is "PROGDIR:Stroke.data", which describes a file in the
  313. same directory as the executable. You can change the filename from
  314. the tooltype named "DATAFILE". "Last Saved" will try to read the
  315. datafile, "Save Strokes" writes it.
  316.  
  317. An icon is currently created for the data file. This makes it
  318. easier to move the commodity AND the datafile from one place to
  319. another. For example you can just drag the commodity and the data
  320. file to WBStartup-drawer and be done with it. Oops, I take that
  321. back, seems it's not that simple.
  322.  
  323. Because WB gets confused when you have an icon for the datafile
  324. in the WBStartup directory, I recommend that you install Stroke
  325. into its own directory and just copy a project icon with the
  326. default tool stroke (and whatever the path will be) into the
  327. WBStartup drawer. (The install script does this.) This has two
  328. advantages:
  329. 1) you don't need to copy the catalog files and
  330. 2) everything stroke-related will be kept in the same directory.
  331. So, if you later remove the stroke commodity, it'll be easier.
  332.  
  333. You can't define an action that invokes strokes. You need
  334. to send stroke button press and stroke button release events,
  335. but because of how the commodity works, only the button press
  336. will be received by the commodity when generated by the commodity
  337. itself.
  338.  
  339.  
  340.  
  341.  
  342. Bugs & To do
  343. ~~~~~~~~~~~~
  344. The old popkey remains active even if you select "Reset to Defaults"
  345. or "Last Saved". Live with it or quit and restart stroke commodity
  346. after changing the hotkey.
  347.  
  348. The executable really needs to be named "Stroke". If you always start
  349. the commodity from shell, you can rename it to anything you like, but
  350. then you shouldn't start it from workbench anymore.
  351.  
  352.  
  353.  
  354.  
  355. Greetings go to:
  356.     Henrik Herranen        For talking about the idea so many times.
  357.     Janne Salmijärvi    For mental support..
  358.     Timo Kaikumaa        For testing and suggestions
  359.  
  360.  
  361.  
  362.  
  363. Event generation
  364. ~~~~~~~~~~~~~~~~
  365. Format:    '<' [<type>] [[-]<qualifier>] [<direction>] <keydef> '>'
  366.     or
  367.     <ascii-text>
  368.  
  369.  
  370. Type:
  371.     DISKINSERTED    DISKREMOVED    EVENT        NEWPOINTERPOS
  372.     NEWPREFS    POINTERPOS    RAWKEY        RAWMOUSE
  373.     TIMER
  374.  
  375. Qualifier:
  376.     CAPSLOCK    CAPS_LOCK    CONTROL        CTRL
  377.     LALT        LAMIGA        LBUTTON        LCOMMAND
  378.     LEFTBUTTON    LEFT_ALT    LEFT_AMIGA    LEFT_BUTTON
  379.     LEFT_COMMAND    LEFT_SHIFT    LSHIFT        MBUTTON
  380.     MIDBUTTON    MIDDLEBUTTON    MIDDLE_BUTTON    NUMERICPAD
  381.     NUMERIC_PAD    NUMPAD        NUM_PAD        RALT
  382.     RAMIGA        RBUTTON        RCOMMAND    RELATIVEMOUSE
  383.     REPEAT        RIGHTBUTTON    RIGHT_ALT    RIGHT_AMIGA
  384.     RIGHT_BUTTON    RIGHT_COMMAND    RIGHT_SHIFT    RSHIFT
  385.     ALT        CAPS        SHIFT
  386.  
  387. Key direction:
  388.     UPSTROKE
  389.  
  390. Special keys:
  391.     BACKSPACE    BREAK        COMMA        CURSOR_DOWN
  392.     CURSOR_LEFT    CURSOR_RIGHT    CURSOR_UP    DEL
  393.     DELETE        DOWN        END        ENTER
  394.     ESC        ESCAPE        F1        F10
  395.     F11        F12        F2        F3
  396.     F4        F5        F6        F7
  397.     F8        F9        HELP        HOME
  398.     INSERT        LEFT        PAGE_DOWN    PAGE_UP
  399.     PAUSE        RETURN        RIGHT        SPACE
  400.     SPACEBAR    TAB        UP
  401.  
  402. Rawmouse button events:
  403.     MOUSE_LEFTPRESS
  404.     MOUSE_MIDDLEPRESS
  405.     MOUSE_RIGHTPRESS
  406.  
  407. Keypad keys:
  408.     (        )        *        +
  409.     -        .        /        0
  410.     1        2        3        4
  411.     5        6        7        8
  412.     9        /        .
  413.  
  414.  
  415.